﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Gadgets.Accountings
{
	public partial class eFeeTransInquiry : WeifenLuo.WinFormsUI.Docking.DockContent  
	{
		public eFeeTransInquiry()
		{
			InitializeComponent();
		}
		
		private void eFeeTransInquiry_Load(object sender, EventArgs e)
		{
			try
			{
                ABSCommonLibrary.CreateGridView(ref gridControl1);
                colTRANS_DATE.FormatSpecifier = DeclareLibrary.DATE_DISPLAY_FORMAT;
                colFEE_AMOUNT.FormatSpecifier = DeclareLibrary.CURRENCY_FORMAT;
                colFEE_RATE.FormatSpecifier = DeclareLibrary.NUMBER_FORMAT;
                colAMOUNT.FormatSpecifier = DeclareLibrary.CURRENCY_FORMAT;
			}
			catch (Exception ex)
			{
				ABSCommonLibrary.ShowErrorMessage(ex.ToString());
			}
		}

		private void load_grid()
		{
            DateTime trans_date = DeclareLibrary.MARKET_DAY;
            string account_no = string.Empty;
            string status = string.Empty;
            string tran_type = string.Empty;
            if (valueRow1.Cells["ACCOUNT_NO"].Value != null)
                account_no = valueRow1.Cells["ACCOUNT_NO"].Value.ToString();
            if (valueRow1.Cells["TRANS_DATE"].Value != null)
                trans_date = Convert.ToDateTime(valueRow1.Cells["TRANS_DATE"].Value);
            if (valueRow1.Cells["STATUS"].Value != null)
                status = valueRow1.Cells["STATUS"].Value.ToString();                
            if (valueRow1.Cells["TRANS_TYPE"].Value != null)
                tran_type = valueRow1.Cells["TRANS_TYPE"].Value.ToString();
            DataSet v_data = ABSCommonLibrary.DoInquiry(
                              CommonLibrary.CommonLibrary.BOSC018001, new object[4]{
                    trans_date, account_no, tran_type, status});
            gridControl1.SetDataBinding(v_data, v_data.Tables[0].TableName);
		}

        private void eFeeTransInquiry_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.KeyCode == Keys.F9)
                {
                    load_grid();
                }
            }
            catch (Exception ex)
            {
                ABSCommonLibrary.ShowErrorMessage(ex.ToString());
            }
        }
	}
}